GY-SHT31-D Digital Temperature and Humidity Sensor

  • RM10.00

  • Product Code: GY-SHT31-D
  • Availability: In Stock

The digital SHT31D humidity sensor series takes sensor technology to a new level. The SHT31D humidity sensor series consists of a low-cost version with the  SHT30 humidity sensor, a standard version with the  SHT31 humidity sensor, and a high-end version with the SHT35 humidity sensor. Automotive grade versions are also available. The SHT31D humidity sensor series combines multiple functions and various interfaces (I2C, analog voltage output) with a applications-friendly, very wide operating voltage range (2.15 to 5.5 V). The SHT31D humidity sensor is available in both large and small volumes.

 

Pinout diagram:

                                                                  

 

Breakout scheme:                                                                    

Interfacing SHT3x Temperature and Humidity sensor with Arduino

Circuit Diagram:

                                                                              SHT3x Temperature and Humidity sensor with Arduino circuit diagram

 

Source Code:

#include <LiquidCrystal_I2C.h>
#include <Arduino.h>
#include "Adafruit_SHT31.h"
LiquidCrystal_I2C lcd (0x3F, 16,2); 
Adafruit_SHT31 sht31 = Adafruit_SHT31();
byte degree[8] =
{
0b00011,
0b00011,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
 
void setup() {
Serial.begin(9600);
lcd.init ();
lcd.backlight ();
lcd.createChar(1, degree);
 
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
 
Serial.println("SHT31 test");
if (! sht31.begin(0x44)) { // Set to 0x45 for alternate i2c addr
Serial.println("Couldn't find SHT31");
while (1) delay(1);
}
}
 
void loop() {
float t = sht31.readTemperature();
float h = sht31.readHumidity();
 
if (! isnan(t)) { // check if 'is not a number'
Serial.print("Temp *C = "); Serial.println(t);
lcd.print("Temp = ");
lcd.print(t);
lcd.write(1);
lcd.print("C");
} else {
Serial.println("Failed to read temperature");
lcd.print("Temperature Error");
}
 
if (! isnan(h)) { // check if 'is not a number'
Serial.print("Hum. % = "); Serial.println(h);
lcd.setCursor (0,1);
lcd.print("Hum. = ");
lcd.print(h);
lcd.print(" %");
} else {
Serial.println("Failed to read humidity");
lcd.setCursor (0,1);
lcd.print("Humidity Error");
}
Serial.println();
delay(1000);
lcd.clear();
}

Write a review

Note: HTML is not translated!
    Bad           Good